package voip.main;

import cs252.voip.R;
import voip.directory.client.DirectoryClient;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        this.setContentView(R.layout.first_screen);
		// Set an EditText view to get user input 
		final EditText userNameField = (EditText) findViewById(R.id.user_name_field);
		final EditText IPField = (EditText) findViewById(R.id.ip_address_field);
		final Button connectButton = (Button) findViewById(R.id.ConnectButton);
		
		connectButton.setOnClickListener(new OnClickListener() {
		
			@Override
			public void onClick(View arg0) {
		
			    Intent myIntent = new Intent(MainActivity.this, DirectoryClient.class);
			    myIntent.putExtra("user_name", userNameField.getText().toString().trim());
			    myIntent.putExtra("ip_address", IPField.getText().toString().trim());
			    MainActivity.this.startActivity(myIntent);
			    
			}
		  });

    }

}
    